package com.woohua.thread.pool;

import java.util.concurrent.TimeUnit;

/***
 * @title Worker
 * @description
 * @author woo hua
 * @version 1.0.0
 * @create 2023/3/17 17:14
 **/
public class Worker implements Runnable{

    private String name;

    public Worker(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        exec();
    }

    //模拟任务执行
    private void exec() {
        try {
            TimeUnit.SECONDS.sleep(2);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println(name + " be called.");
    }
}
